package itheima.com.Utiley;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class KoalaCopy {

    public static void main(String[] args) {

        String filePath = "D:\\一条小团团\\a\\xxx.jpg";
        String filePath2 = "D:\\一条小团团2\\1.jpg";
        FileInputStream fis = null;
        FileOutputStream fos = null;

        try {
            fis = new FileInputStream(filePath2);
            fos = new FileOutputStream(String.valueOf(filePath));
//            定义一个读取数组提高读取小路
            byte[] b = new byte[1024];
            int len = 0;
            while ((len = fis.read(b)) != -1) {
//                nfos.write(b, 0, len);
                fos.write(b);
            }
            System.out.println("拷贝ok~");

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if (fis != null) {
                    fis.close();
                }
                if (fos != null) {
                    fos.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }




}
